﻿using System.Collections.Generic;
using Entitas;
class EnemyBattleEngageSystem : ReactiveSystem<EnemyEntity>
{
    public EnemyBattleEngageSystem(Contexts contexts) : base(contexts.enemy)
    {
            
    }

    protected override void Execute(List<EnemyEntity> entities)
    {
        foreach( var e in entities)
        {
            if (e.isRoaming == true)
                e.isRoaming = false;
        }
    }

    protected override bool Filter(EnemyEntity entity)
    {
        return entity.isBattleEngaged == true;
    }

    protected override ICollector<EnemyEntity> GetTrigger(IContext<EnemyEntity> context)
    {
        return context.CreateCollector(EnemyMatcher.BattleEngaged.Added());
    }
}
